#ifndef TICKANIMATION_H
#define TICKANIMATION_H

#include "Animation.h"

class TickAnimation : public Animation {
public:
	typedef void (*TickFunc)(void* closure);
private:
	delay_t delay;
	int repetitions;
	TickFunc action;
	void* closure;
public:
	TickAnimation(animid_t id, delay_t d, int r, TickFunc a, void* c ) : Animation(id),
		delay(d), repetitions(r), action((TickFunc) a), closure((void*) c) {}
	~TickAnimation(void) {}
	delay_t GetDelay(void) { return delay; }
	int GetRepetitions(void) { return repetitions; }
	void SetRepetitions(int r) { repetitions = r; }
	void ExecuteAction(void) { if (action) (*action)(closure); }
	Animation* Clone (animid_t newId) const {
		return new TickAnimation(newId, delay, repetitions, action, closure);
	}
};

#endif